#include <iostream>
#include <vector>
#include <string>
using namespace std;
string convert(string s, int numRows)
{
    if (numRows == 1)
        return s;
    int n = s.length();
    string arr[numRows];
    string re = "";
    int row = 0;
    int goingdown = 1; //1往下0往上
    for (int i = 0; i < n; i++)
    {
        arr[row] += s[i];
        //cout<<row<<" ";
        row = goingdown == 1 ? (row + 1 >= numRows ? goingdown = 0, row - 1 : row + 1) : (row - 1 < 0 ? goingdown = 1, row + 1 : row - 1);
    }
    for (string s : arr)
    {
        re += s;
    }
    return re;
}
int main()
{
    //z型测试
    cout << convert("AB", 1) << endl;
    return 0;
}